package com.xique.park.bean.transform.web.car;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;


/**
 * 自定义车辆类型转换器
 */
public class MynTypeConverter implements Converter<String> {


    @Override
    public Class supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public String convertToJavaData(CellData cellData, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return null;
    }

    @Override
    public CellData convertToExcelData(String s, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        switch (s){
            case "1":
                return new CellData("月卡类");
            case "2":
                return new CellData("登记临停类");
            case "3":
                return new CellData("邀请访客类");
            case "4":
                return new CellData("会员临停类");
            case "5":
                return new CellData("普通临停类");
            case "on":
                return new CellData("在场");
            case "out":
                return new CellData("出场");
        }
        return new CellData("");
    }
}
